﻿using System;
using Volo.Abp.Domain.Entities;

namespace ParkManagement
{
    /// <summary>
    /// 里程类
    /// </summary>
    public class Consumption : Entity<int>
    {
        /// <summary>用户Id</summary>
        public int UserId { get; protected set; }

        /// <summary>车辆编号</summary>
        public int CarId { get; protected set; }

        /// <summary>行驶日期</summary>
        public DateTime TravelDate { get; protected set; }

        /// <summary>行驶里程</summary>
        public int TravelDistance { get; protected set; }

        /// <summary>金额（元）</summary>
        public decimal Amount { get; protected set; }

        /// <summary>加油量（升）</summary>
        public double GasFilling { get; protected set; }

        /// <summary>车辆信息</summary>
        public Car Car { get; protected set; }

        private Consumption() { }

        internal Consumption(
            int userId,
            int carId,
            DateTime travelDate,
            int travelDistance,
            decimal amount,
            double gasFilling)
        {
            UserId = userId;
            CarId = carId;
            TravelDate = travelDate;
            TravelDistance = travelDistance;
            Amount = amount;
            GasFilling = gasFilling;
        }

        /// <summary>
        /// 设置行驶日期
        /// </summary>
        /// <param name="travelDate"></param>
        public Consumption SetTravelDate(DateTime travelDate)
        {
            TravelDate = travelDate;
            return this;
        }

        /// <summary>
        /// 设置行驶里程
        /// </summary>
        /// <param name="travelDistance"></param>
        public Consumption SetTravelDistance(int travelDistance)
        {
            TravelDistance = travelDistance;
            return this;
        }

        /// <summary>
        /// 设置金额
        /// </summary>
        /// <param name="amount"></param>
        public Consumption SetAmount(decimal amount)
        {
            Amount = amount;
            return this;
        }

        /// <summary>
        /// 设置加油量
        /// </summary>
        /// <param name="gasFilling"></param>
        public Consumption SetGasFilling(double gasFilling)
        {
            GasFilling = gasFilling;
            return this;
        }
    }
}